/**
 * 
 */
package com.mc.metaSearch;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Class Name: baidu_thread
 * @Author zhenjiang liu
 * @Date 2010-12-25
 * @Time 上午10:02:23
 */
public class baidu_thread extends Thread{
	String querystring;
	String[] r;
	Map<Integer ,String> burls;
	Map<Integer ,String> babstracts;
	Map<Integer ,String> btitles;
	Map<Integer ,String> bsubtitles;
	/**
	 * @param querystring2
	 */
	public baidu_thread(String querystring) {
		this.querystring=querystring;
	}
	public String[]getR()
	{
		try{
			this.join();
			return r;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
	}
	public Map<Integer ,String> getulr()
	{
		try
		{
			this.join();
			return burls;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
		
	}
	public Map<Integer ,String> getabstracts()
	{
		try{
			this.join();
			return babstracts;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
		
	}
	public Map<Integer ,String>gettitle()
	{
		try{
			this.join();
			return btitles;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
	}	
	public Map<Integer ,String>getsubtitle()
	{
		try{
			this.join();
			return bsubtitles;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
	}
	public void run()
	{
		BaiduSearch b = new BaiduSearch();		
		try {
			Thread.sleep(20);
			r = b.getContent(this.querystring);
			burls = b.getURL(r);
			babstracts = b.getAbstract(r);
			btitles = b.getTitle(r);
			bsubtitles=b.bsubtitles;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
